import {
  request,
  withCancelToken
} from '@/utils/request'


const check = (data) => {
  return request('/register/check',{
    method: 'get',
    params: {
      ...data
    }
  })
}


const sms = (data) => {
  return request('/register/code', {
    method: 'get',
    params: {
      ...data
    }
  })
}

const register = (data) => {
  return request('/register', {
    method: 'post',
    data
  })
}


const smsLogin = (data) => {
  return request('/code', {
    method: 'get',
    params: {
     ...data
    }
  })
}


const login = (data)=>{
  return request('/login',{
    method: 'post',
    data
  })
}

const [smsSend] = withCancelToken(sms)
const [registerSend] = withCancelToken(register)
const [ smsLoginSend ] = withCancelToken(smsLogin)
const [checkSend] = withCancelToken(check)
const [loginSend] = withCancelToken(login)


export {
  smsSend,
  registerSend,
  smsLoginSend,
  checkSend,
  loginSend
}